<?php

	/* SVN FILE: $Id: civab.php 8 2011-03-13 08:32:38Z michele.andreoletti@gmail.com $ */
	
	/**
	 * Project Name : arcadia
	 *
	 * @author $Author: michele.andreoletti@gmail.com $
	 * @version $Revision: 8 $
	 * @lastrevision $Date: 2011-03-13 08:32:38 +0000 (Sun, 13 Mar 2011) $
	 * @filesource $URL: http://arcadia.googlecode.com/svn/trunk/budget/civab.php $
	 */
	 
	require_once 'include/functions.php';
	require_once 'include/const.inc.php';
	require_once '../include/auth.inc.php';
	require_once '../include/conn.inc.php';
	
	$aItems = array();
	
	fnGetValueFromGET(array('term'));
	
	$sQuery = "SELECT  `sCivab`, `sDescrizione` FROM `civab` WHERE `sCivab` LIKE '%$term%' OR `sDescrizione` LIKE '%$term%' GROUP BY `sCivab` ORDER BY `sDescrizione` LIMIT 12";
	
	if (isset($sQuery) && !empty($sQuery)){
		$aResult = custom_mysql_query ($sQuery);
		while ($aRow = mysql_fetch_array ($aResult)) {
			$aItems[] = array("sCivab" => strip_tags($aRow['sCivab']), "value" => strip_tags($aRow['sDescrizione']));
		}
	}

	echo array_to_json($aItems);
	die();
?>
	

